package be.bonamis.timesheet.service;

import java.util.List;

import be.bonamis.timesheet.dto.PrestationDTO;
import be.bonamis.timesheet.model.Prestation;

/**
 * Declares methods used to obtain and modify Prestation information.
 * @author Florent Bonamis
 */
public interface PrestationService {

    /**
     * Creates a new prestation.
     * @param prestationDTO   The information of the created prestation.
     * @return  The created prestation.
     */
    public Prestation create(PrestationDTO prestationDTO);

    /**
     * Deletes a prestation.
     * @param prestationId  The id of the deleted prestation.
     * @return  The deleted prestation.
     * @throws ProjectNotFoundException  if no prestation is found with the given id.
     */
    public Prestation delete(Long prestationId) throws ProjectNotFoundException;

    /**
     * Finds all prestations.
     * @return  A list of prestations.
     */
    public List<Prestation> findAll();
    
    /**
     * Finds all prestations by project
     * @return  A list of prestations.
     */
    public List<Prestation> findByProject(long projectId);

    /**
     * Finds prestation by id.
     * @param id    The id of the wanted prestation.
     * @return  The found prestation. If no prestation is found, this method returns null.
     */
    public Prestation findById(Long id);

    /**
     * Updates the information of a prestation.
     * @param updated   The information of the updated prestation.
     * @return  The updated prestation.
     * @throws ProjectNotFoundException  if no prestation is found with given id.
     */
    public Prestation update(Prestation updated) throws ProjectNotFoundException;
}
